
#ifndef AOE_H
#define AOE_H

#include "effects.h"
#include "enhsim.h"

class AoE: public Effect {
public:
	/**
	 * Constructors & Destructor
	 */
	AoE(EnhSim* simulator);
	virtual ~AoE();

	/**
	 * Set the additional target and target percentage
	 */
	void setAdditionalTargets(const int& additional_targets, const f32& additional_target_percent, const int additional_target_level);

	/**
	 * Calculate start and end time of the aoe block
	 */
	void calculateAoETime(const int64& simulation_duration);

	/**
	 * This event occurse when the aoe block starts or ends.
	 * Sets the aoeing boolean
	 */
	void event(const int& event_id);

	/**
	 * This function is called at the start of the simulation and trows an
	 * event depending on the aoe_start_time.
	 * Sets the aoeing boolean
	 */
	void setAoEEvent();

	/**
	 * Calculates the melee and spell damage reduction based on target level
	 */
	void calculateDamageReduction();

	/**
	 * Creates the rotation array and sets the rotation count
	 */
	void setRotationCount(const int& count);

	/**
	 * Sets the specified Castable in the rotation array
	 */
	void setRotation(const int& index, Castable* cast);

	int getAdditiontalTargets();
	bool getAoeing();
	
	int getRotationCount();
	Castable* getRotation(const int& index);

	f32& getMagicResistance(const int& index);

private:
	/* Additional targets to aoe */
	int additional_targets;
	/* The level of all the additional targets */
	int additional_target_level;
	/* Damage reduction: calculated from target level*/
	int white_crit_reduction;
	int yellow_crit_reduction;
	f32 magic_resistance[MAGIC_SCHOOL_SIZE];

	/* Time the additional targets are in aoe range */
	f32 additional_target_percent;

	/* Time when the targets move in aoe range */
	int64 aoe_start_time;
	/* Time when the targets exit aoe range */
	int64 aoe_end_time;

	/* Wether the targets are in aoe range */
	bool aoeing;

	/* Number of skills in the rotation */
	int rotation_count;
	Castable** rotation;
};

#endif
